package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.CustomerOrdersProject;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/orders/project")
@Slf4j
@RequiredArgsConstructor
@Api(tags = "客户订单项目管理")
public class CustomerOrdersProjectController extends BaseController {

    private final CustomerOrdersProject customerOrdersProject;

    @GetMapping("/page")
    @ApiOperation("分页查询客户订单项目")
    public ResponseResult<PageResponse<NursingProjectVo>> pageList(
            @ApiParam(value = "项目名称") String name,
            @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
            @ApiParam(value = "每页数量", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
            @ApiParam(value = "状态") Integer status
    ){
        PageResponse<NursingProjectVo> pageResponse = customerOrdersProject.pageList(name,pageNum,pageSize,status);
        return success(pageResponse);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据ID查询客户订单项目")
    public ResponseResult selectById(@ApiParam(value = "项目ID") @PathVariable Integer id){
        NursingProjectVo nursingProjectVo = customerOrdersProject.getById(id);
        return success(nursingProjectVo);
    }
}